<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="keywords" content=""/>
	<title>{$title}</title>
	<link rel="stylesheet" type="text/css" href="css/base.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script src="js/jquery.min.js"></script>
 <script type="text/javascript" src="../style/playstyle/Turntable/jQueryRotate.2.2.js"></script>
<script type="text/javascript" src="../style/playstyle/Turntable/jquery.easing.min.js"></script>
</head>
<body>
	<!--容器-->
	<div class="container">
		<!--内容-->
		<div class="content activity_game_turnplate">
			<!--游戏-->
			<div>
				<div class="f_l">
				<img src="{$style}/images/game1.png" height="auto" width="100%" alt="" class="f_l">
				<!-- 游戏开始 -->
					<div class="turntableDemo">
		                <div id="disk"></div>
		                <div id="start"><img src="../style/playstyle/Turntable/images/start.png" id="startbtn" alt="转盘开启" /></div>
		            </div> 
		            <script type="text/javascript">
            $(function() {
                $("#startbtn").click(function() {
                    lottery();
                });
                
                $("#playbtn").click(function() {
                    lottery();
                });
            });
            function lottery() {
                $.ajax({
                    type: 'POST',
                    url: '{$_url}/player/turntable.php',
                    dataType: 'json',
                   //dataType: 'text',
                    cache: false,
                    error: function() {
                        alert('积分不足');
                        return false;
                    },
                    success: function(json) {
                    	if(json == '积分不足'){
                    		alert(json);
                    	}else{
                    		$("#startbtn").unbind('click').css("cursor", "default");
                            var angle = json.angle; //指针角度 
                            var prize = json.prize; //中奖奖项标题 
                            $("#startbtn").rotate({
                                duration: 3000, //转动时间 ms
                                angle: 0, //从0度开始
                                animateTo: 3600 + angle, //转动角度 
                                easing: $.easing.easeOutSine, //easing扩展动画效果
                                callback: function() {
                                	if(prize){
    	                                var resulte = confirm('恭喜您中得' + prize + '\n想要继续吗？');
    	                                if (resulte) { //若是点击确定，继续抽奖
    	                                    lottery();
    	                                }else{
    	                                	location.href='/?act=activity&met=activity_turntable';
    	                                }
                                	}else{
                                		alert('谢谢参与');
                                		location.href='/?act=activity&met=activity_turntable';
                                	}
                                }
                            });
                    	}                      
                    }
                });
            }
        </script>
		           <!-- 游戏结束 -->
					<!-- <img src="{$style}/images/game1.png" height="auto" width="100%" alt="" class="f_l"> -->
				</div>
				<div class="f_l">
					<div class="f_l activity_turnplate_bg">
						<img src="{$style}/images/game_turnplate_descBg.png" height="217" width="720" alt="立即抽奖" >
					</div>
					<div class="f_l activity_turnplate_desc">
						<div>一次游戏消费{$rs['jifen']}个活动积分</div>
						<div class="activity_turnplate_btn"  id="playbtn">立即抽奖</div>
						<div class="activity_turnplate_record">
							<a href="/?act=activity&met=activity_record">我的游戏记录</a>
						</div>
					</div>
					<div class="qfd"></div>
				</div>
				<div class="qfd"></div>
			</div>
			<!--游戏结束-->
			<!--游戏规则-->
			<div class="activity_turnplate_rule">
				<!--标题-->
				<div class="activity_rule_title">
					<div class="across_line_ffee02"></div>
					<div class="activity_rule_text">游戏规则</div>
				</div>
				<!--标题结束-->
				<!--列表-->
				<div class="activity_rule_list">
					<ul>
						{$rs['guize']}
					</ul>
				</div>
			</div>
			<!--游戏规则结束-->
			{if(@$winn)}
			<!--中奖名单-->
			<div class="activity_turnplate_prize">
				<!--标题-->
				<div class="activity_rule_title">
					<div class="across_line_ffee02"></div>
					<div class="activity_rule_text">中奖名单</div>
				</div>
				<!--标题结束-->
				<!--列表-->
				<div class="activity_prize_turnplate">
					<ul>
					{foreach($winn as $k=>$v1)}
						<li>
							<div class="f_l">恭喜{code(echo substr_replace($v1['phone'],'****',3,4))}</div>
							<div class="f_l">抽中{$v1['jiangpin']}</div>
							<div class="f_l">{if(time() - $v1['time'] < 60)}刚刚
					{elseif(time() - $v1['time'] < 60*60)}{code(echo floor((time() - $v1['time'])/60))}分钟前
					{elseif(time() - $v1['time'] < 60*60*12)}{code(echo floor((time() - $v1['time'])/(60*60)))}小时前
					{else}{code(echo date('m-d H:i',$v1['time']))}{/if}</div>
							<div class="qfd"></div>
						</li>
					{/foreach}
					</ul>
				</div>
				<!--列表结束-->
			</div>
			<!--中奖名单结束-->
			{/if}
		</div>
		<!--内容结束-->
	</div>
	<!--容器结束-->
</body>
</html>